using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class ICTemplateEntryMap : EntityTypeConfiguration<ICTemplateEntry>
    {
        public ICTemplateEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FID, t.FFieldName });

            // Properties
            this.Property(t => t.FID)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.FFieldName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FHeadCaption)
                .HasMaxLength(50);

            this.Property(t => t.FRelationID)
                .HasMaxLength(400);

            this.Property(t => t.FAction)
                .HasMaxLength(400);

            this.Property(t => t.FFilter)
                .HasMaxLength(255);

            this.Property(t => t.FSaveRule)
                .HasMaxLength(50);

            this.Property(t => t.FHeadCaption_CHT)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FHeadCaption_EN)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FDefaultValue)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FMaxValue)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FMinValue)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FFormat)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("ICTemplateEntry");
            this.Property(t => t.FID).HasColumnName("FID");
            this.Property(t => t.FCtlOrder).HasColumnName("FCtlOrder");
            this.Property(t => t.FCtlIndex).HasColumnName("FCtlIndex");
            this.Property(t => t.FCtlType).HasColumnName("FCtlType");
            this.Property(t => t.FLookUpCls).HasColumnName("FLookUpCls");
            this.Property(t => t.FNeedSave).HasColumnName("FNeedSave");
            this.Property(t => t.FValueType).HasColumnName("FValueType");
            this.Property(t => t.FSaveValue).HasColumnName("FSaveValue");
            this.Property(t => t.FFieldName).HasColumnName("FFieldName");
            this.Property(t => t.FEnable).HasColumnName("FEnable");
            this.Property(t => t.FPrint).HasColumnName("FPrint");
            this.Property(t => t.FHeadCaption).HasColumnName("FHeadCaption");
            this.Property(t => t.FWidth).HasColumnName("FWidth");
            this.Property(t => t.FNeedCount).HasColumnName("FNeedCount");
            this.Property(t => t.FRelationID).HasColumnName("FRelationID");
            this.Property(t => t.FAction).HasColumnName("FAction");
            this.Property(t => t.FMustInput).HasColumnName("FMustInput");
            this.Property(t => t.FFilter).HasColumnName("FFilter");
            this.Property(t => t.FSaveRule).HasColumnName("FSaveRule");
            this.Property(t => t.FDefaultCtl).HasColumnName("FDefaultCtl");
            this.Property(t => t.FVisForBillType).HasColumnName("FVisForBillType");
            this.Property(t => t.FRelateOutTbl).HasColumnName("FRelateOutTbl");
            this.Property(t => t.FSysMustInputItem).HasColumnName("FSysMustInputItem");
            this.Property(t => t.FHeadCaption_CHT).HasColumnName("FHeadCaption_CHT");
            this.Property(t => t.FHeadCaption_EN).HasColumnName("FHeadCaption_EN");
            this.Property(t => t.FStatCount).HasColumnName("FStatCount");
            this.Property(t => t.FIsVisibleForList).HasColumnName("FIsVisibleForList");
            this.Property(t => t.FCanEditedAllTime).HasColumnName("FCanEditedAllTime");
            this.Property(t => t.FAllowCopy).HasColumnName("FAllowCopy");
            this.Property(t => t.FDefaultValue).HasColumnName("FDefaultValue");
            this.Property(t => t.FMaxValue).HasColumnName("FMaxValue");
            this.Property(t => t.FMinValue).HasColumnName("FMinValue");
            this.Property(t => t.FFormat).HasColumnName("FFormat");
            this.Property(t => t.FPrintStatus).HasColumnName("FPrintStatus");
        }
    }
}
